<!--
 * @Descripttion: 
 * @Author: 圣坤
 * @Date: 2020-08-06 09:41:18
 * @LastEditors: weishihao
 * @LastEditTime: 2020-08-12 08:41:44
-->
<script>
export default {
  onLaunch: function () {
	 uni.hideHomeButton()
    console.log('App Launch')
    try {
      let value = uni.getStorageSync('token')
      if (!value) {
        uni.reLaunch({
          url: '/pages/login/login',
        })
      } else {
        let auditState = uni.getStorageSync('factoryinfo')
        if (value && auditState.reviewState === 2) {
          uni.switchTab({
            url: '/pages/index/index',
          })
        } else if (
          (value && auditState.reviewState === 1) ||
          auditState.reviewState === 3
        ) {
          uni.redirectTo({
            url:
              '/pages/authentication/audit?auditInfo=' +
              JSON.stringify(uni.getStorageSync('factoryinfo')),
          })
        } else if (value && auditState.reviewState === 0) {
          uni.redirectTo({
            url: '/pages/authentication/authentication',
          })
        }else{
		uni.switchTab({
		  url: '/pages/index/index',
		})
		}
      }
    } catch (e) {
      console.log(e)
    }
  },
  onShow: function () {
    console.log('App Show')
  },
  onHide: function () {
    console.log('App Hide')
  },
}
</script>

<style lang="scss">
/* 公共样式 */
// @import './common/uni.css';
@import './common/common.css';
@import 'uview-ui/index.scss';
/* 自定义样式库 */
@import './common/free.css';
/* 解决头条小程序组件内引入字体不生效的问题 */
/* #ifdef MP-TOUTIAO */
@font-face {
  font-family: uniicons;
  src: url('/static/uni.ttf');
}
/* #endif */
page {
  background-color: #f8f8f8;
}
</style>
